﻿using System.Collections.Generic;
using MvcWechat.Common;

namespace MvcWechat.Services
{
    public class WeixinConfigs
    {
        public  List<WeixinConfigs> weixinConfigs { get; set; }
        public static WXTokenHelper WxokenHelper { private set; get; }
        public static Dictionary<string, ConfigSettings> listConfigSettings { private set; get; }
        public static void Register()
        {
            listConfigSettings = CommonPage.SuppplierAllKey;
            foreach (var config in listConfigSettings)
            {
                if (config.Value!=null)
                {
                    if (config.Value.AppIDByWX != "" && config.Value.AppSecretByWX != "")
                    {
                        WxokenHelper = new WXTokenHelper(config.Value.AppIDByWX, config.Value.AppSecretByWX, 6200);
                        WxokenHelper.Run();
                    }
                }
            }
            //Token = System.Configuration.ConfigurationManager.AppSettings["Token"];
            //EncodingAESKey = System.Configuration.ConfigurationManager.AppSettings["EncodingAESKey"];
            //AppID = System.Configuration.ConfigurationManager.AppSettings["AppIDByWx"];
            //AppSecret = System.Configuration.ConfigurationManager.AppSettings["AppSecretByWx"];
            ////PartnerKey = System.Configuration.ConfigurationManager.AppSettings["PartnerKey"];
            ////mch_id = System.Configuration.ConfigurationManager.AppSettings["mch_id"];
            ////device_info = System.Configuration.ConfigurationManager.AppSettings["device_info"];
            ////spbill_create_ip = System.Configuration.ConfigurationManager.AppSettings["spbill_create_ip"];
            ////是否开启微信JS接口，1：开启，0：不开启（由于开启JS功能需要定时获取jstickect,会消耗一部分性能，所以不需要JS接口的请写0）
            ////var openJSSDK = int.Parse(System.Configuration.ConfigurationManager.AppSettings["OpenJSSDK"]) > 0;
            //OauthScope = System.Configuration.ConfigurationManager.AppSettings["OauthScope"];

            //wntitle = System.Configuration.ConfigurationManager.AppSettings["wntitle"];
            //wndescription = System.Configuration.ConfigurationManager.AppSettings["wndescription"];
            //wnurl = System.Configuration.ConfigurationManager.AppSettings["wnurl"];
            //picurl = System.Configuration.ConfigurationManager.AppSettings["picurl"];
            //Domain = System.Configuration.ConfigurationManager.AppSettings["Domain"];
            //IsUseCustomerMenu = System.Configuration.ConfigurationManager.AppSettings["IsUseCustomerMenu"];
            ////扫码登录
            //AppIDByWechatLogin = System.Configuration.ConfigurationManager.AppSettings["AppIDByWechatLogin"];
            //AppSecretByWechatLogin = System.Configuration.ConfigurationManager.AppSettings["AppSecretByWechatLogin"];


            //Senparc.Weixin.MP.Containers.WxCardApiTicketContainer.Register(AppID, AppSecret);

        }
    }
}
